#!/bin/bash

# Test force cluster recovery with new nodes

. ./common

for i in `seq 0 5`; do
    _start_sheep $i
done
_wait_for_sheep 6
_cluster_format -c 6
_vdi_create test 20M -P
$DOG cluster info | _filter_cluster_info

$DOG cluster shutdown
_wait_for_sheep_stop

for i in 0 1 2 3 4 6; do
    _start_sheep $i
done
_wait_for_sheep 6
for i in 0 1 2 3 4 6; do
    $DOG cluster info -p 700$i | _filter_cluster_info
    _vdi_list
done

echo yes | $DOG cluster recover force
echo ""

_wait_for_sheep_recovery 0
$DOG vdi check test | sort

for i in 0 1 2 3 4 6; do
    $DOG cluster info -p 700$i | _filter_cluster_info
    _vdi_list
done

_start_sheep 5
_wait_for_sheep 7
for i in 0 1 2 3 4 5 6; do
    $DOG cluster info -p 700$i | _filter_cluster_info
    _vdi_list
done
